<?php require_once "menu.php"; ?>
<table width="100%" class="menubar" cellpadding="0" cellspacing="0" border="0">
    <tr>
        <td class="menudottedline" width="40%"><div class="pathway"></div></td>
        <td class="menudottedline" align="right">
            <table cellpadding="0" cellspacing="0" border="0" id="toolbar">
                <tr height="60" valign="middle" align="center">
                    <td>
                        <a class="toolbar" href="#" id="backlink">
                        <?php echo $html->image('admin/restore_f2.png', array('align' => 'middle', 'border' => 0)); ?><br>Back
                        </a>
                    </td>
                    <td>
                        <a class="toolbar" href="#">
                        <?php echo $html->image('admin/help_f2.png', array('align' => 'middle', 'border' => 0)); ?><br>Help
                        </a>
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
<br>
<br>
<div align="center" class="centermain">
    <div class="main">

        <table class="adminheading">
            <tr>
                <th class="info" rowspan="2" nowrap>SMTP Information</th>
            </tr>
        </table>

        <form id="ticketForm" name="ticketForm" method="post">
            <div class="error"></div>
            <input type="hidden" id="alert" />
            <table class="adminlist">
                <tr>
                    <th colspan="2">&nbsp;</th>
                </tr>
                <tr>
                    <td width="12%" id="input_label"><font color="red"><b>*</b></font>&nbsp;Host</td>
                    <td style="border: 1px dotted #ccc; background-color: #efefef;">
                        <input type="text" id="host" name="data[smtp][host]" class="{required:true}" style="width: 250px;" />
                    </td>
                </tr>
                <tr>
                    <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Username</td>
                    <td style="border: 1px dotted #ccc; background-color: #efefef;">
                        <input type="text" id="username" name="data[smtp][uid]" class="{required:true, minlength:4}" style="width: 250px;" />
                    </td>
                </tr>
                <tr>
                    <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Password</td>
                    <td style="border: 1px dotted #ccc; background-color: #efefef;">
                        <input type="password" id="password" name="data[smtp][password]" class="{required:true, minlength:4}" style="width: 250px;" />
                    </td>
                </tr>
                <tr>
                    <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Retype Password</td>
                    <td style="border: 1px dotted #ccc; background-color: #efefef;">
                        <input type="password" id="retype_password" name="data[smtp][retype_password]" class="{equalTo:'#password'}" style="width: 250px;" />
                    </td>
                </tr>
                <tr>
                    <td id="input_label">&nbsp;Incoming Port</td>
                    <td style="border: 1px dotted #ccc; background-color: #efefef;">
                        <input type="text" id="incoming" name="data[smtp][incoming]" class="{required:true, number:true}" style="width: 50px;" value="110" />
                    </td>
                </tr>
                <tr>
                    <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Outgoing Port</td>
                    <td style="border: 1px dotted #ccc; background-color: #efefef;">
                        <input type="text" id="outgoing" name="data[smtp][outgoing]" class="{required:true, number:true}" style="width: 50px;" value="25" />
                    </td>
                </tr>
                <tr>
                    <td id="input_label"><font color="red"><b>*</b></font>&nbsp;Timeout</td>
                    <td style="border: 1px dotted #ccc; background-color: #efefef;">
                        <input type="text" id="timeout" name="data[smtp][timeout]" class="{required:true, number:true}" style="width: 50px;" value="60" />
                    </td>
                </tr>
                <tr>
                    <td colspan="2">&nbsp;</td>
                </tr>
                <tr>
                    <td>&nbsp;</td>
                    <td><input type="button" id="submitbtn" value="Save" style="width: 150px; height: 30px;" class="button" /></td>
                </tr>
            </table>
        </form>

    </div>
</div>
<script type="text/javascript">
$().ready(function() {
    $("#submitbtn").click(function(){
        $("#ticketForm").attr('action', '<?php echo $html->url("/smtp/smtpadd");?>');
        $("#ticketForm").submit();
    });

    $("#backlink").click(function (){
        window.location = "<?php echo $html->url('/smtp/smtpmgnt'); ?>";
    });

    $("#ticketForm").validate({
        errorLabelContainer: $("#ticketForm div.error")
    });

    var msg = "<?php echo $alert; ?>";
    if (msg) {
        alert(msg);
    }
});
</script>